using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OracleClient;

using DQS.EL;

namespace DQS.DAL
{
    public static class DQ_SetConditionService
    {
        public static void InsertCondtion(IList<DQ_SETCONDITION> argConds)
        {
            String conStr = String.Empty;
            String paramStr = String.Empty;
            foreach (DQ_SETCONDITION setCon in argConds)
            {
                conStr += (setCon.COND_ID + "|");
                paramStr += (setCon.PARAMS + "|");
            }
            conStr = conStr.Substring(0, conStr.Length - 1);
            paramStr = paramStr.Substring(0, paramStr.Length - 1);
            string sqlStr = "DQ_Insert_Condition_P";
            OracleParameter[] _params = { 
                new OracleParameter("query_id",OracleType.Number),
                new OracleParameter("cond_id",OracleType.Clob),
                new OracleParameter("params",OracleType.Clob)
            };
            _params[0].Value = argConds[0].QUERY_ID;
            _params[1].Value = conStr;
            _params[2].Value = paramStr;
            OracleHelper.ExecuteNonQuery(sqlStr, CommandType.StoredProcedure, _params);
        }
    }
}
